//
//  UIButton+TYFactory.m
//  TYUIKit
//
//  Created by TuyaInc on 2019/5/14.
//

#import "UIButton+TYFactory.h"

@implementation UIButton (TYFactory)

+ (instancetype)ty_buttonWithFont:(UIFont *)font textColor:(UIColor *)textColor {
    return [self ty_buttonWithFont:font textColor:textColor backgroundColor:nil frame:CGRectZero];
}
+ (instancetype)ty_buttonWithFont:(UIFont *)font textColor:(UIColor *)textColor backgroundColor:(UIColor *)backgroundColor {
    return [self ty_buttonWithFont:font textColor:textColor backgroundColor:backgroundColor frame:CGRectZero];
}
+ (instancetype)ty_buttonWithFont:(UIFont *)font textColor:(UIColor *)textColor backgroundColor:(UIColor *)backgroundColor frame:(CGRect)frame {
    UIButton *btn = [UIButton new];
    if (font) {
        btn.titleLabel.font = font;
    }
    if (textColor) {
        [btn setTitleColor:textColor forState:UIControlStateNormal];
    }
    if (backgroundColor) {
        btn.backgroundColor = backgroundColor;
    }
    btn.frame = frame;
    return btn;
}

@end
